home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000358_fdc@columbia.edu_Thu Sep 12 10:16:38 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  67 lines

  1. Article: 13690 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.unix.aix,comp.protocols.kermit.misc
  5. Subject: Re: renaming files
  6. Date: 12 Sep 2002 10:14:36 -0400
  7. Organization: Columbia University
  8. Lines: 50
  9. Message-ID: <alq7gc$12b$1@watsol.cc.columbia.edu>
  10. References: <alplgq$ks8$1@sp15at20.hursley.ibm.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1031840077 2384 128.59.39.139 (12 Sep 2002 14:14:37 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 12 Sep 2002 14:14:37 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.unix.aix:240229 comp.protocols.kermit.misc:13690
  16.  
  17. In article <alplgq$ks8$1@sp15at20.hursley.ibm.com>, Me <me@u.com> wrote:
  18. :   I wonder if anyone can help with a small script file that I need to write.
  19. : I need to automatically FTP some files that have the following naming
  20. : convention :-
  21. :      Day of month
  22. :       |    Hour and minute stamp
  23. :       |     |
  24. :       \/    \/
  25. :   log.11-10-30
  26. :   log.11-3-45
  27. :   log.11-5-30
  28. :   log.9-10-30
  29. :   log.9-5-45
  30. :   log.10-10-0
  31. :   ...
  32. :   I'm fine with automating the FTP but the problem is, FTP doesn't like the
  33. : '-' in the naming convention and replaces it with a '#' when it writes it to
  34. : the other system.
  35. :
  36. When you say you need to "ftp" them, do you mean PUT or GET?  The mechanics
  37. are different in the two cases, and also depend on the target system.
  38. For example, if you are sending these files to an 8.3 filesystem such as
  39. FAT on DOS, Windows, or OS/2, obviously the timestamp will be truncated.
  40. I can't imagine why a hyphen might cause trouble but...
  41.  
  42. :   What I need to do is run a script that would rename the files, replacing
  43. : the '-' with an 'x' or something.
  44. The Kermit FTP client can do this:
  45.  
  46.   http://www.columbia.edu/kermit/ftpscripts.html
  47.  
  48. Unlike other FTP clients, it is designed from the beginning to be scripted:
  49.  
  50.   http://www.columbia.edu/kermit/ftpscripts.html
  51.  
  52. If you can explain the scenario in a bit more detail I can give more
  53. specific help.  Assuming that all you need to do is what you say (i.e.
  54. convert the hyphen to some other character like 'x'), it's done like this:
  55.  
  56.   mput /as-name:\freplace(\v(filename),-,x) log.*
  57.  
  58. The /as-name:xxx switch specifies a template for converting the filenames.
  59. The \freplace() function replaces substrings of the given string with
  60. another string of your choice; in this case it's replacing all hyphens in
  61. each filename with 'x'.
  62.  
  63. - Frank
  64.